"""Add user authentication infos

Revision ID: 221d918aa9f0
Revises: 127be3fb000
Create Date: 2016-06-06 13:45:52.915050

"""

# revision identifiers, used by Alembic.
import sqlalchemy as sa
from alembic import op

revision = "221d918aa9f0"
down_revision = "127be3fb000"


def upgrade():
    # has no effect on other DBMS
    # read here for more info: http://alembic.zzzcomputing.com/en/latest/ops.html#alembic.operations.Operations.batch_alter_table
    with op.batch_alter_table("users", schema=None) as batch_op:
        batch_op.add_column(sa.Column("activated", sa.Boolean(), nullable=True))
        batch_op.add_column(
            sa.Column("last_failed_login", sa.DateTime(), nullable=True)
        )
        batch_op.add_column(sa.Column("login_attempts", sa.Integer(), nullable=True))
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("users", schema=None) as batch_op:
        batch_op.drop_column("activated")
        batch_op.drop_column("login_attempts")
        batch_op.drop_column("last_failed_login")
    ### end Alembic commands ###
